package com.message.Aliyun_ai_API.Enum;

public enum TextFont {

    dongfangdakai(1, "dongfangdakai"),
    puhuiti_m(2, "puhuiti_m"),
    shuheiti(3, "shuheiti"),
    jinbuti(4, "jinbuti"),
    kuheiti(5, "kuheiti"),
    kuaileti(6, "kuaileti"),
    wenyiti(7, "wenyiti"),
    logoti(8, "logoti"),
    cangeryuyangti_m(9, "cangeryuyangti_m"),
    siyuansongti_b(10, "siyuansongti_b"),
    siyuanheiti_m(11, "siyuanheiti_m"),
    fangzhengkaiti(12, "fangzhengkaiti");

    private final int styleCode;
    private final String styleName;

    TextFont(int styleCode, String styleName) {
        this.styleCode = styleCode;
        this.styleName = styleName;
    }

    public int getStyleCode() {
        return styleCode;
    }

    public String getStyleName() {
        return styleName;
    }

    // 从整数获取枚举值
    public static TextFont fromStyleCode(int styleCode) {
        for (TextFont style : values()) {
            if (style.getStyleCode() == styleCode) {
                return style;
            }
        }
        throw new IllegalArgumentException("Invalid style code: " + styleCode);
    }

    // 从字符串获取枚举值
    public static TextFont fromStyleName(String styleName) {
        for (TextFont style : values()) {
            if (style.getStyleName().equalsIgnoreCase(styleName)) {
                return style;
            }
        }
        throw new IllegalArgumentException("Invalid style name: " + styleName);
    }
}
